﻿using Microsoft.AspNetCore.SignalR.Client;
using Newtonsoft.Json;
using System;
using System.Threading;

namespace client
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            HubConnection connection = new HubConnectionBuilder().WithUrl("http://localhost:5000/StudentHub").Build();
            connection.Closed += async (error) =>
            {
                Console.WriteLine("close");
            };
            connection.On<String>("Return_QueryStudent", (arg) =>
            {
                Object obj = JsonConvert.DeserializeObject(arg);
                Console.WriteLine(obj);
            });
            connection.StartAsync();

            Thread.Sleep(3000);
            connection.SendAsync("QueryStudent");
            

            Console.ReadLine();
        }
    }
}
